package com.xjtu.platform.demander.editquestion.dao;


import com.xjtu.platform.common.CurrentUser;
import com.xjtu.platform.demander.editquestion.Editquestion;
import com.xjtu.platform.demander.editquestion.EditquestionDto;
import com.xjtu.platform.demander.editquestion.OptionsDto;
import org.apache.ibatis.annotations.*;


import java.util.List;

@Mapper
public interface EditquestionDao {
    List<Editquestion> findEditquestionList(CurrentUser currentUser);

    @Update("update requirements set  stage = 3,mode = #{mode} ,question_content = #{question_content} where user_id = #{user_id} and request_id = #{request_id}")
    void updatequestion(EditquestionDto dto);

    @Select("select count(option_id) from options")
    int getId();

    @Delete("delete from options where request_id = #{dto.request_id}")
    void deleteoption(@Param("dto") OptionsDto optionsDto);

    @Insert("insert into options values(#{id},#{dto.request_id},#{dto.option_type},#{dto.option_content})")
    void insertOpt(@Param("dto") OptionsDto optionsDto,@Param("id") String oid);

    @Update("update requirements set stage = 3 where request_id = #{request_id}")
    void addStage(String request_id);
}
